“The OS illusion: making one CPU act like it’s 20.”
Every running program isn’t just code — it’s a process, an isolated world with its own memory, resources, and identity.
The OS juggles hundreds of these, switching between them so smoothly you think it’s multitasking.
A process is a running instance of a program with:
Analogy: A person at a desk, working with their own supplies, taking turns at the CPU coffee machine.
States
Transitions: scheduler decisions, I/O events, system calls.
New → Ready → Running → Terminated Waiting
graph TD; A-->B; A-->C; B-->D; C-->D;
Each arrow represents a system call or interrupt that changes who holds the CPU.
A thread is a lightweight process inside another process.
All threads share: • Memory space • Code / data sections • File descriptors
Each thread has: • Own stack • Own program counter • Own schedule
When the CPU switches threads/processes:
Overhead: switching too often wastes cycles — scheduling aims to minimize that.
Schedulers decide:
Common strategies:
Processes interact with the OS via system calls: fork(), exec(), wait(), read(), write() …
fork()
exec()
wait()
read()
write()
They’re the controlled bridge from user mode → kernel mode.
pid = fork() if pid == 0: exec("child_program") else: wait(pid)
Simulate multiple processes competing for CPU:
Shows the lifecycle in motion instead of static theory.
Understanding processes and threads explains:
Every higher-level abstraction depends on these primitives.
Finish the sentence:
“A thread is like a __ because it __.”
Examples
Next Week 01 Topic 03: Scheduling & Context Switching
topic: "Operating Systems Week 1 Lecture Slides" focus: "Processes and Threads" format: "Markdown-based slide content" author: "T. Griffin and OpenAI GPT-5" credit: "Concept scaffolding with ChatGPT (OpenAI GPT-5)"